#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

inline void File_Read() {
#ifdef MYLAB
	freopen("in.txt", "r", stdin);
#endif
}

inline int get_num() {
	int k = 0, f = 1;
	char c = getchar();
	for(; !isdigit(c); c = getchar())if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
	return k;
}

int n, m, k, now;
bool h[2000023];

int main() {
	File_Read();
	n = get_num();
	m = get_num();
	k = get_num();
	now = 1;
	for(int i = 1; i <= m; i++) {
		h[get_num()] = 1;
	}
	
	for(int i = 1; i <= k; i++) {
		int u = get_num();
		int v = get_num();
		if(h[now]) {
			break;
		}
		if(now == u) {
			now = v;
		}
		else if(now == v) {
			now = u;
		}
		
	}
	printf("%d", now);
	
	return 0;
}
